package com.amt.olcacon.config;

import com.fasterxml.jackson.core.StreamWriteConstraints;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class JsonConfig {

    @Bean
    public ObjectMapper objectMapper() {
        log.info("load custom ObjectMapper");
        ObjectMapper mapper = new ObjectMapper();
        mapper.getFactory().setStreamWriteConstraints(
                StreamWriteConstraints.builder().maxNestingDepth(50).build()
        );
        log.info("max nesting depth : 50");
        return mapper;
    }


}
